﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IrisGenerator.Framework.Messaging
{
    public static class Button
    {
        public static MessageButtons ConvertFrom(MessageBoxButtons buttons)
        {
            switch (buttons)
            {
                case MessageBoxButtons.AbortRetryIgnore:
                    return MessageButtons.AbortRetryIgnore;
                    break;
                case MessageBoxButtons.OK:
                    return MessageButtons.Ok;
                    break;
                case MessageBoxButtons.OKCancel:
                    return MessageButtons.OkCancel;
                    break;
                case MessageBoxButtons.RetryCancel:
                    return MessageButtons.RetryCancel;
                    break;
                case MessageBoxButtons.YesNo:
                    return MessageButtons.YesNo;
                    break;
                case MessageBoxButtons.YesNoCancel:
                    return MessageButtons.YesNoCancel;
                    break;
                default:
                    return MessageButtons.Ok;
                    break;
            }
        }
        public static MessageButtons ConvertFrom(int value)
        {
            switch (value)
            {
                case 0:
                    return MessageButtons.AbortRetryIgnore;
                    break;
                case 1:
                    return MessageButtons.Ok;
                    break;
                case 2:
                    return MessageButtons.OkCancel;
                    break;
                case 3:
                    return MessageButtons.RetryCancel;
                    break;
                case 4:
                    return MessageButtons.YesNo;
                    break;
                case 5:
                    return MessageButtons.YesNoCancel;
                    break;
                default:
                    return MessageButtons.Ok;
                    break;
            }
        }
        public static MessageButtons ConvertFrom(string value)
        {
            return (MessageButtons)Enum.Parse(typeof(MessageButtons), value);
        }

        public static MessageBoxButtons ConvertToMessageBoxButtons(MessageButtons buttons)
        {
            switch (buttons)
            {
                case MessageButtons.AbortRetryIgnore:
                    return MessageBoxButtons.AbortRetryIgnore;
                case MessageButtons.Ok:
                    return MessageBoxButtons.OK;
                case MessageButtons.OkCancel:
                    return MessageBoxButtons.OKCancel;
                   
                case MessageButtons.RetryCancel:
                    return MessageBoxButtons.RetryCancel;
                    
                case MessageButtons.YesNo:
                    return MessageBoxButtons.YesNo;
                   
                case MessageButtons.YesNoCancel:
                    return MessageBoxButtons.YesNoCancel;
                default:
                    return MessageBoxButtons.OK;
                    
            }
        }
    }
}
